﻿using System.Collections;
using System.Collections.Generic;
using UnityEngine;

namespace linkouqs.Gamekit {
    
public abstract class CharacterState : StateMachineBehaviour {

        protected CharacterController2D Character { get; private set; }

        public override void OnStateEnter(Animator animator, AnimatorStateInfo stateInfo, int layerIndex) {
            Character = animator.GetComponent<CharacterController2D>();
            if(Character != null) { 
                Character.CurrentState = this;
            }
        }

        public override void OnStateExit(Animator animator, AnimatorStateInfo stateInfo, int layerIndex) {
            Character = null;
        }

    }
}

